    /*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package control;

import javax.microedition.lcdui.Display;
import views.ViewMenu;
import views.viewAbout;
import views.viewCleaner;
import views.viewCleaning;
import views.viewHelp;
import views.viewLoading;
import views.viewMoreApps;

/**
 *
 * @author Béo
 */
public class Controller {

    public static Controller instance = null;
    public static Main main;
    public viewLoading viewLoading = null;
    private ViewMenu viewmenu = null;
    private viewAbout viewabout = null;
    private viewHelp viewhelp = null;
    private viewMoreApps viewmoreapps = null;
    public static viewCleaner viewcleaner = null;
    private viewCleaning viewcleaning = null;

    public Controller() {
    }

    public static Controller getInstance() {
        if (instance == null) {
            instance = new Controller();
        }
        return instance;
    }

    public void chay(Main main) {
        this.main = main;
            viewmenu = new ViewMenu();
            Display.getDisplay(main).setCurrent(viewmenu);
            viewmenu.draw();
    }

    public void exit() {
        main.destroyApp(true);
    }

    public void showAbout() {
        viewabout = new viewAbout();
        Display.getDisplay(main).setCurrent(viewabout);
        viewabout.draw();
    }

    public void showHome() {
        viewmenu = new ViewMenu();
        viewmenu.draw();
        Display.getDisplay(main).setCurrent(viewmenu);
    }

    public void showHelp() {
        viewhelp = new viewHelp();
        Display.getDisplay(main).setCurrent(viewhelp);
        viewhelp.draw();
    }

    public void showMoreApps() {
        viewmoreapps = new viewMoreApps();
        Display.getDisplay(main).setCurrent(viewmoreapps);
        viewmoreapps.draw();
    }

    public void showCleaner() {
        if (viewcleaner == null) {
            viewcleaner = new viewCleaner();
        }
        Display.getDisplay(main).setCurrent(viewcleaner);
        viewcleaner.draw();
    }

    public void showCleaning() {
        viewcleaning = new viewCleaning();
        Display.getDisplay(main).setCurrent(viewcleaning);
        viewcleaning.start();
    }
}
